home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Applications 2001 May / SGI IRIX 6.5 Applications 2001 May.iso / dev / insight_dev.idb / usr / include / make / commondocrules.z / commondocrules
Encoding:
Text File  |  2001-04-05  |  25.9 KB  |  818 lines

  1. #    Common rules for making SGML and HTML 
  2.  
  3. # BOOK_FILES is defined when it's an SGML book...
  4. #if defined(BOOK_FILES)
  5. SOURCES     = ${BOOK_FILES}
  6. TMP_TARGETS = ${BOOK_FILES:.doc=.sgm}
  7. TARGETS     = ${TMP_TARGETS:.fm=.sgm}
  8.  
  9. TMP_XXX_FILES = ${BOOK_FILES:S/.doc$/.sgm/g}
  10. XXX_FILES   = ${TMP_XXX_FILES:S/.fm$/.sgm/g}
  11. SGM_FILES   = ${XXX_FILES:S/.mif$/.sgm/g}
  12. VER_FILES   = ${SGM_FILES:S/.sgm$/.ver/g}
  13. ERR_FILES   = ${SGM_FILES:S/.sgm$/.err/g}
  14. DIRT_FILES  = ${SGM_FILES:S/.sgm$/.ctl/g} booklist.txt
  15.  
  16. TMP_MIF_FILES = ${BOOK_FILES:S/.doc$/.mif/g}
  17. MIF_FILES   = ${TMP_MIF_FILES:S/.fm$/.mif/g}
  18. TMP_BACKUP_FILES = ${BOOK_FILES:S/.doc$/.backup.doc/g}
  19. BACKUP_FILES = ${TMP_BACKUP_FILES:S/.fm$/.backup.fm/g}
  20.  
  21. #if ${BOOK_FILES:S/[     ]*/ /g} == "${MIF_FILES}"
  22. MIF_FILES   =
  23. #endif
  24. #endif
  25.  
  26. #if ${BOOK_FILES} == "book.sgm"
  27. PARSE_SGML  = TRUE
  28. SGM_FILES   != ls book.sgm *.sgml | grep -v ${MASTER_SGM}
  29. MIF_FILES   =
  30. VER_FILES   =
  31. ERR_FILES   =
  32. DIRT_FILES  = booklist.txt
  33. #endif
  34.  
  35. SHELF       != echo ${BOOKSHELF} | sed "s/.*\///"
  36. LANG_ID     != echo ${BOOK_LANG} | sed "s/_.*//" | tr "[a-z]" "[A-Z]" | sed "s/JA/JP/" | sed "s/C/EN/"
  37. DOCTYPE        = '<!DOCTYPE SGIDOCBK PUBLIC "-//Silicon Graphics, Inc.//DTD DocBook V2.3-based Subset V1.5//${LANG_ID}" [ ]>'
  38.  
  39. LANGUAGE    != echo ${LANG_ID} | tr "[A-Z]" "[a-z]" | sed "s/jp/ja/" 
  40. MKBOOK_FLAGS = -language ${LANGUAGE}
  41.  
  42. # all the definitions based on the specific DTD in the Makefile
  43. #if ${DTD} == "SGIDOCBK"
  44. REAL_DTD = ${SGIDOCBK_LIB}/dtd/default.dtd
  45. STYLES_DIR = ${SGIDOCBK_LIB}/styles
  46. BOOK_CTL = ${SGIDOCBK_LIB}/book.ctl
  47. SRCH_TAGS = TITLE:Titles;CAPTION,FIGURE:Figure Captions:1;CAPTION,TABLE:Table Captions:1;TABLE:Tables;CODE EXAMPLE:Code Examples
  48. HIDDEN ?= FALSE
  49.  
  50. #elif ${DTD} == "SGIDOC"
  51. REAL_DTD = ${SGIDOC_LIB}/dtd/default.dtd
  52. STYLES_DIR = ${SGIDOC_LIB}/styles
  53. SRCH_TAGS = TITLE:Titles;CAPTION,FIGURE:Figure Captions:1;CAPTION,TABLE:Table Captions:1;TABLE:Tables;CODE EXAMPLE:Code Examples
  54. HIDDEN ?= FALSE
  55.  
  56. #elif ${DTD} == "XHELP"
  57. REAL_DTD = ${XHELP_LIB}/dtd/XHELP.dtd
  58. STYLES_DIR = ${XHELP_LIB}/styles
  59. SRCH_TAGS = HELPLABEL,HELPTOPIC TITLE:Titles:1;TITLE,FIGURE:Figure Captions:1;EXAMPLE:Code Examples
  60. HIDDEN ?= TRUE
  61.  
  62. #elif ${DTD} == "DOCBOOK"
  63. REAL_DTD = ${DOCBOOK_LIB}/dtd/docbook.dtd
  64. STYLES_DIR = ${DOCBOOK_LIB}/styles
  65. SRCH_TAGS = TITLE:Titles;TITLE,FIGURE:Figure Captions:1;TITLE,TABLE:Table Captions:1;TABLE:Tables;EXAMPLE:Code Examples
  66. HIDDEN ?= FALSE
  67.  
  68. #else
  69. REAL_DTD = ../../${BOOK}.dtd
  70. STYLES_DIR = ../../styles
  71. #endif
  72.  
  73. # XXX Problem with multi-byte locales and bob index generation.
  74. # XXX This capability is disabled.
  75. #
  76.  
  77. #if ${BOOK_LANG} == "C"
  78. GLOSS = ${GLOSS_C}
  79. #elif ${BOOK_LANG} == "de" 
  80. GLOSS = ${GLOSS_de}
  81. #elif ${BOOK_LANG} == "fr" 
  82. GLOSS = ${GLOSS_fr}
  83. #elif ${BOOK_LANG} == "ja_JP.EUC" 
  84. GLOSS = ${GLOSS_ja_JP.EUC}
  85. NO_BOB_INDEX = TRUE
  86. #elif ${BOOK_LANG} == "ja_JP.SJIS" 
  87. GLOSS = ${GLOSS_ja_JP.SJIS}
  88. NO_BOB_INDEX = TRUE
  89. #elif ${BOOK_LANG} == "ko_KR.euc" 
  90. GLOSS = ${GLOSS_ko_KR.euc}
  91. NO_BOB_INDEX = TRUE
  92. #elif ${BOOK_LANG} == "zh_CN.ugb" 
  93. GLOSS = ${GLOSS_zh_CN.ugb}
  94. NO_BOB_INDEX = TRUE
  95. #elif ${BOOK_LANG} == "zh_CN.gbk" 
  96. GLOSS = ${GLOSS_zh_CN.gbk}
  97. NO_BOB_INDEX = TRUE
  98. #elif ${BOOK_LANG} == "zh_TW.ucns" 
  99. GLOSS = ${GLOSS_zh_TW.ucns}
  100. NO_BOB_INDEX = TRUE
  101. #elif ${BOOK_LANG} == "zh_TW.big5" 
  102. GLOSS = ${GLOSS_zh_TW.big5}
  103. NO_BOB_INDEX = TRUE
  104. #else
  105. INVALID_LANG = "TRUE"
  106. GLOSS = ${GLOSS_C}
  107. #endif
  108.  
  109. .SUFFIXES: .sgm .doc .fm .mif .ver .err
  110.  
  111. ## Rule for converting Frame files to MIF files
  112. ## if not SGIDOC DTD then don't use the conditional file
  113. .fm.mif .doc.mif:
  114. #if ${DTD} == "SGIDOC"
  115.     @TMPFILE=${TMPDIR}/${@:.mif=.$$.tmp}; \
  116.     TMP_CONDITION_FILE=${TMPDIR}/${@:.mif=.$$.cond.tmp}; \
  117.     echo "system \"cp ${CONDITION_FILE} $${TMP_CONDITION_FILE}\"" > $${TMPFILE}; \
  118.     echo "system \"chmod 664 $${TMP_CONDITION_FILE}\"" >> $${TMPFILE}; \
  119.     echo "Open $<" >> $${TMPFILE}; \
  120.     echo "Open $${TMP_CONDITION_FILE}" >> $${TMPFILE}; \
  121.     echo "UseFormatsFrom x $< $${TMP_CONDITION_FILE}" >> $${TMPFILE}; \
  122.     echo "SaveAs m $< $*.mif.tmp" >> $${TMPFILE}; \
  123.     echo "Quit $<" >> $${TMPFILE}; \
  124.     ${FMBATCH} $${TMPFILE}; \
  125.     echo ${MIFHEADER} > $*.mif; \
  126.     echo "#SGI=$*" >> $*.mif; \
  127.     cat $*.mif.tmp >> $*.mif; \
  128.     ${RM} -f $${TMPFILE} $*.mif.tmp $${TMP_CONDITION_FILE}
  129. #elif ${DTD} == "SGIDOCBK"
  130.     @TMPFILE=${TMPDIR}/${@:.mif=.$$.tmp}; \
  131.     TMP_CONDITION_FILE=${TMPDIR}/${@:.mif=.$$.cond.tmp}; \
  132.     echo "system \"cp ${CONDITION_FILE} $${TMP_CONDITION_FILE}\"" > $${TMPFILE}; \
  133.     echo "system \"chmod 664 $${TMP_CONDITION_FILE}\"" >> $${TMPFILE}; \
  134.     echo "Open $<" >> $${TMPFILE}; \
  135.     echo "Open $${TMP_CONDITION_FILE}" >> $${TMPFILE}; \
  136.     echo "UseFormatsFrom x $< $${TMP_CONDITION_FILE}" >> $${TMPFILE}; \
  137.     echo "SaveAs m $< $*.mif.tmp" >> $${TMPFILE}; \
  138.     echo "Quit $<" >> $${TMPFILE}; \
  139.     ${FMBATCH} $${TMPFILE}; \
  140.     echo ${MIFHEADER} > $*.mif; \
  141.     echo "#SGI=$*" >> $*.mif; \
  142.     cat $*.mif.tmp >> $*.mif; \
  143.     ${RM} -f $${TMPFILE} $*.mif.tmp $${TMP_CONDITION_FILE}
  144. #else
  145.     @TMPFILE=${TMPDIR}/${@:.mif=.$$.tmp}; \
  146.     echo "Open $<" > $${TMPFILE}; \
  147.     echo "SaveAs m $< $*.mif" >> $${TMPFILE}; \
  148.     echo "Quit $<" >> $${TMPFILE}; \
  149.     ${FMBATCH} $${TMPFILE}; \
  150.     ${RM} -f $${TMPFILE}
  151. #endif
  152.  
  153. # Rule for converting MIF files to SGML files
  154. # this also builds CGM figures if necessary
  155. .mif.sgm:
  156. #if ${DTD} == "SGIDOCBK"
  157.     @${MIF2SGIDOCBK} ${CGM_NOTRAS} $<
  158. #elif ${DTD} == "SGIDOC"
  159. #if defined(BOOK_LANG)
  160.     @${MIF2SGML} ${CGM_NOTRAS} -i ${INTL_MAP_DIR}/${BOOK_LANG}.intl_map $<
  161. #else
  162.     @${MIF2SGML} ${CGM_NOTRAS} $<
  163. #endif
  164. #elif ${DTD} == "XHELP"
  165.     @echo "Frame to XHELP not supported at this time"; exit 1
  166. #elif ${DTD} == "DOCBOOK"
  167.     @echo "Generic Frame to DocBook requires Passage's translator"; exit 1
  168. #else
  169.     ${OTHER_TRANSLATOR} $<
  170. #endif
  171.     -@ mkdir -p online 1> /dev/null 2>&1
  172.     @if (`grep 'RASTERCONVERT' $*.sgm>/dev/null`) then \
  173.       echo "Creating CGM images..."; \
  174.       (CLHOME=${CLHOME}; MIFTOCGM_IP=${MIFTOCGM_IP}; \
  175.         export CLHOME MIFTOCGM_IP; \
  176.         ${MIFTOCGM} ${CGM_VERBOSE} -c ${CLHOME}/data/kt.map -i $< -o online/$*.cgm ); \
  177.       TIFF_FILES=`grep '<!-- RASTERCONVERT:' $*.sgm |sed -e 's/.*<!-- RASTERCONVERT: \(.*\) -->.*/\1/'` ; \
  178.       for i in $${TIFF_FILES} ; do \
  179.             echo "Converting" $$i "to GIF"; \
  180.         N_GIF=`echo $$i|sed 's/\.cgm$$/-1.gif/'|sed 's/\.cgm\([0-9][0-9]*\)/-\1\.gif/'`; \
  181.             (CLHOME=${CLHOME}; export CLHOME; \
  182.             ${CLTRANS} online/$$i online/$$i.out -of tiff \
  183.             ${CGM_VERBOSE} \
  184.             -oo "${CGM_VERBOSE} -t palette -comp lzw -dpi 285"); \
  185.             ${TIFFTOPNM} online/$$i.out | ${PNMSCALE} .37 | ${PNMCROP} | \
  186.         ${PNMMARGIN} -white 10 | \
  187.         ${PPMQUANT} 256 > ${TMPDIR}/$$i.ppm; \
  188.         /usr/sbin/fromppm ${TMPDIR}/$$i.ppm ${TMPDIR}/$$i.rgb; \
  189.         /usr/sbin/hipass3 ${TMPDIR}/$$i.rgb ${TMPDIR}/$$i.rgb_sh .5; \
  190.         ${TOGIF} ${TMPDIR}/$$i.rgb_sh online/$${N_GIF} ; \
  191.             /bin/rm online/$$i.out online/$$i ${TMPDIR}/$$i.ppm ${TMPDIR}/$$i.rgb ${TMPDIR}/$$i.rgb_sh; \
  192.       done; \
  193.     fi
  194.  
  195. # Rule for generating SGML Validation report files for SGML files
  196. .sgm.ver:
  197.     @echo "SGML Validation not supported at this time"; exit 1
  198.  
  199. # Rule for generating UNKNOWN errors report files for SGML files
  200. .sgm.err:
  201.     -@${EGREP} '<\!\-\- ERROR|<\!\-\- WARNING|<UNKNOWN.ERROR' $< > $*.err
  202.  
  203. EndPart:
  204.     @echo "</PART>" > EndPart
  205.  
  206. EndPart.err:
  207.     @touch EndPart.err
  208.  
  209. # Build the master SGML file which is concatenation of all individual
  210. # SGML files with TITLE at the front and <SGIDOCBK> tag around
  211. # the <BOOK> and individual chapter content.
  212. #
  213. # OR parse the book.sgm file to generate the master SGML file
  214.  
  215. #if make(review)
  216. REVIEW=-draft
  217. #endif
  218.  
  219. #if ${NUMBERED_HEADS} == "Y"
  220. NUM_HEADS_ARG=-numheads
  221. #endif
  222.  
  223. ${MASTER_SGM}: ${SGM_FILES}
  224. #if defined(INVALID_LANG)
  225.     @echo "WARNING: ${BOOK_LANG} is an unsupported LANG value. Supported values are:"
  226.     @echo " C, de, fr, ja_JP.EUC, ja_JP.SJIS, ko_KR.euc, zh_CN.ugb,"
  227.     @echo " zh_CN.gbk, zh_TW.ucns, and zh_TW.big5."
  228. #endif
  229.     @echo " ======== Building master sgml file ======== "
  230.     @${RM} -f ${MASTER_SGM}
  231.     @if [ "${SGM_FILES}" = "" ] ; then \
  232.       echo "error: No SGML files to process"; \
  233.       exit 1; \
  234.     fi 
  235.     @${RM} -f ${TMP_MASTER_SGM}
  236.     @${RM} -f ${INDEXFILE}
  237. #if defined(PARSE_SGML)
  238.     @${RM} -f bobindex.idx
  239.     @${SPAM} -c ${CATALOG} -r -mms -x -x ${BOOK_FILES} > ${TMP_MASTER_SGM}
  240.     @${MAKE_BLDSGML} $(REVIEW) $(NUM_HEADS_ARG) -I${TMP_MASTER_SGM} -O${MASTER_SGM}
  241. #if make(install)
  242.     @${RM} -f ${TMP_MASTER_SGM}
  243.     @${MV} ${MASTER_SGM} ${TMP_MASTER_SGM}
  244.     @${XFORM_SGML} -I${TMP_MASTER_SGM} -O${MASTER_SGM}
  245. #endif
  246.     @${RM} -f ${TMP_MASTER_SGM}
  247. #else
  248. #if ${DTD} == "SGIDOC" || ${DTD} == "SGIDOCBK"
  249. #if ! defined(NO_BOB_INDEX)
  250. #if ${BOOK_LANG} == "ja_JP.EUC" 
  251. #if ! exists(/usr/lib/locale/ja_JP.EUC/LC_COLLATE)
  252.     @echo "You must have the ja_JP.EUC locale installed to build this book."
  253.     @echo "Please install WorldView_japanese.sw.locale for 6.2 or"
  254.     @echo "WorldView_base_jp_f.sw.locale_euc for 6.5"
  255.     @exit 1
  256. #endif
  257. #elif ${BOOK_LANG} == "ko_KR.euc" 
  258. #if ! exists(/usr/lib/locale/ko_KR.euc/LC_COLLATE)
  259.     @echo "You must have the ko_KR.euc locale installed to build this book."
  260.     @echo "Please install WorldView_korean.sw.locales for 6.2 or"
  261.     @echo "WorldView_base_kr.sw.locales for 6.5"
  262.     @exit 1
  263. #endif
  264. #elif ${BOOK_LANG} == "zh_CN.ugb" 
  265. #if ! exists(/usr/lib/locale/zh_CN.ugb/LC_COLLATE)
  266.     @echo "You must have the zh_CN.ugb locale installed to build this book."
  267.     @echo "Please install WorldView_chinese.sw.user_env_china for 6.2 or"
  268.     @echo "WorldView_base_zh.sw.user_env_china for 6.5"
  269.     @exit 1
  270. #endif
  271. #elif ${BOOK_LANG} == "zh_TW.ucns" 
  272. #if ! exists(/usr/lib/locale/zh_TW.ucns/LC_COLLATE)
  273.     @echo "You must have the zh_TW.ucns locale installed to build this book."
  274.     @echo "Please install WorldView_chinese.sw.user_env_taiwan for 6.2 or"
  275.     @echo "WorldView_base_zh.sw.user_env_taiwan for 6.5"
  276.     @exit 1
  277. #endif
  278. #elif ${BOOK_LANG} == "ja_JP.SJIS" 
  279. #if ! exists(/usr/lib/locale/ja_JP.SJIS/LC_COLLATE)
  280.     @echo "You must have the ja_JP.SJIS locale installed to build this book."
  281.     @echo "Please install WorldView_base_jp_f.sw.locale_sjis for 6.5"
  282.     @exit 1
  283. #endif
  284. #elif ${BOOK_LANG} == "zh_TW.big5" 
  285. #if ! exists(/usr/lib/locale/zh_TW.big5/LC_COLLATE)
  286.     @echo "You must have the zh_TW.big5 locale installed to build this book."
  287.     @echo "Please install WorldView_base_zh.sw.user_env_taiwan_big5 for 6.5"
  288.     @exit 1
  289. #endif
  290. #elif ${BOOK_LANG} == "zh_CN.gbk" 
  291. #if ! exists(/usr/lib/locale/zh_CN.gbk/LC_COLLATE)
  292.     @echo "You must have the zh_CN.gbk locale installed to build this book."
  293.     @echo "Please install WorldView_base_zh.sw.user_env_china_gbk for 6.5"
  294.     @exit 1
  295. #endif
  296. #endif
  297.     @for i in ${SGM_FILES}; do cat $$i >> ${TMP_MASTER_SGM}; done
  298. #if ${DTD} == "SGIDOC"
  299.     @cat ${TMP_MASTER_SGM} | ${INDEXGEN} -s -o ${INDEXFILE}
  300. #else
  301.     @${INDEXGENDB} -i ${TMP_MASTER_SGM} -s -o ${INDEXFILE}
  302. #endif
  303. #endif
  304. #if ${DTD} == "SGIDOC"
  305.     @if [ "${DOC_TYPE}" = "" ] ; then \
  306.       echo "<SGIDOC LANG=\"${BOOK_LANG}\"><MANUAL>" > ${MASTER_SGM}; \
  307.     else \
  308.       echo "<SGIDOC LANG=\"${BOOK_LANG}\"><${DOC_TYPE}>" > ${MASTER_SGM}; \
  309.     fi 
  310. #else
  311.     @echo ${DOCTYPE} > ${MASTER_SGM}
  312. #if ${NUMBERED_HEADS} == "Y"
  313.     @echo "<SGIDOCBK LANG=\"${BOOK_LANG}\" NUMHEADS=\"Y\"><BOOK>" >> ${MASTER_SGM}
  314. #else
  315.     @echo "<SGIDOCBK LANG=\"${BOOK_LANG}\" NUMHEADS=\"N\"><BOOK>" >> ${MASTER_SGM}
  316. #endif
  317. #endif
  318. #endif
  319. #if ! defined(NO_BOB_INDEX) && ${DTD} == "SGIDOCBK"
  320.     cat ${TMP_MASTER_SGM} >> ${MASTER_SGM}
  321. #else
  322.     @for i in ${SGM_FILES}; do cat $$i >> ${MASTER_SGM}; done
  323. #endif
  324. #if ${DTD} == "SGIDOC" || ${DTD} == "SGIDOCBK"
  325. #if ! defined(NO_BOB_INDEX)
  326.     @cat ${INDEXFILE} >> ${MASTER_SGM}
  327. #endif
  328. #if ${DTD} == "SGIDOC"
  329.     @if [ "${DOC_TYPE}" = "" ] ; then \
  330.       echo "</MANUAL></SGIDOC>" >> ${MASTER_SGM} ; \
  331.     else \
  332.       echo "</${DOC_TYPE}></SGIDOC>" >> ${MASTER_SGM} ; \
  333.     fi
  334. #else
  335.     @echo "</BOOK></SGIDOCBK>" >> ${MASTER_SGM}
  336. #endif
  337. #if make(install)
  338.     @${RM} -f ${TMP_MASTER_SGM}
  339.     @${MV} ${MASTER_SGM} ${TMP_MASTER_SGM}
  340.     @${XFORM_SGML} -I${TMP_MASTER_SGM} -O${MASTER_SGM}
  341. #endif
  342.     @${RM} -f ${TMP_MASTER_SGM}
  343. #endif
  344. #endif
  345. #if defined(BOOK_FILTER) && exists(${BOOK_FILTER})
  346.     @${BOOK_FILTER} ${MASTER_SGM} > ${MASTER_SGM}.new
  347.     @${MV} ${MASTER_SGM}.new ${MASTER_SGM}
  348. #endif
  349.  
  350. ${BOOKDIR}/${BOOK}.sgm: ${MASTER_SGM}
  351.     -@mkdir -p ${BOOKDIR} 1> /dev/null 2>&1
  352.     @${RM} -f ${BOOKDIR}/${BOOK}.sgm
  353.     @${CP} ${MASTER_SGM} ${BOOKDIR}/${BOOK}.sgm
  354.  
  355. # Branch rule for making a book out of 'compiled' sgm files, or HTML
  356. #if ${DTD} != "HTML"
  357. default book review help xhelp: mk_book figures
  358.  
  359. #else
  360. default book review help xhelp:
  361.     @echo "operation not supported with HTML books"
  362.  
  363. clobber clean rmtargets fluff tags:
  364.     @echo "operation not supported with HTML books"
  365.  
  366. #if defined(RAWIDB)
  367. install: booklist.txt
  368. #    Generate booklist.txt idb
  369.     $(INSTALL) -m 644 -f ${BOOKSHELF}/${BOOKDIR} \
  370.         -idb '${BOOKSUBSYSTEM} exitop("(chroot \$$rbase /usr/sbin/insightAdmin -avfn ${BOOK_LANG} ${BOOKSHELF}>>\$$rbase/var/share/Insight/install.insight.log)2>>\$$rbase/var/share/Insight/install.insight.log")' \
  371.         booklist.txt
  372. #       Generate helpmap idbs 
  373.     if [ -d help ] ; then \
  374.         (cd help; \
  375.         if [ "${BOOK_LANG}" = "C" ] ; then \
  376.             $(INSTALL) -m 644 -idb $(HELPSUBSYSTEM) \
  377.              -f ${HELPDIR}/help *.helpmap; \
  378.         else \
  379.         $(INSTALL) -m 644 -idb $(HELPSUBSYSTEM) \
  380.             -f ${HELPDIR}/help/${BOOK_LANG} *.helpmap; \
  381.         fi; \
  382.         cd ..); \
  383.     fi
  384. #       Generate book directory idb
  385.     $(INSTALL) -u root -g sys  -m 755 \
  386.         -idb '${BOOKSUBSYSTEM} removeop("if [ -r $$rbase/usr/sbin/insightAdmin ]; then chroot \$$rbase /usr/sbin/insightAdmin -avfn ${BOOK_LANG} ${BOOKSHELF}>>\$$rbase/var/share/Insight/install.insight.log 2>&1; fi")' \
  387.         -dir ${BOOKSHELF}/${BOOKDIR}
  388. #       Generate subdirectory idbs, if any
  389.     for d in $(BOOK_DIRS); do \
  390.         if [ "$$d" != "." ]; then \
  391.         $(INSTALL) -m 755 -idb $(BOOKSUBSYSTEM) \
  392.             -dir ${BOOKSHELF}/${BOOKDIR}/$$d; \
  393.         fi; \
  394.     done
  395. #       Generate files idbs 
  396.     for d in $(BOOK_DIRS); do \
  397.         if [ "$$d" = "." ]; then \
  398.         for ext in ${HTML_EXTS}; do \
  399.             for f in *.$$ext; do \
  400.                 if [ -f $$f ]; then \
  401.                     $(INSTALL) -m 644 -idb $(BOOKSUBSYSTEM) \
  402.                     -f ${BOOKSHELF}/${BOOKDIR} $$f; \
  403.                 fi; \
  404.             done; \
  405.         done; \
  406.         else \
  407.         for ext in ${HTML_EXTS}; do \
  408.             for f in $$d/*.$$ext; do \
  409.                 if [ -f $$f ]; then \
  410.                      $(INSTALL) -m 644 -idb $(BOOKSUBSYSTEM) \
  411.                     -f ${BOOKSHELF}/${BOOKDIR} $$f; \
  412.                 fi; \
  413.             done; \
  414.         done; \
  415.         fi; \
  416.     done
  417. #else
  418. install:
  419.     @echo "warning: 'install' not supported if RAWIDB not defined"
  420.  
  421. #endif
  422. #endif
  423.  
  424. # notice that any tdr files less than 42 in length are being removed
  425. .ORDER: prep_book ${BOOKDIR}/ebt/${BOOK}.edr
  426. pub_book mk_book: prep_book ${BOOKDIR}/ebt/${BOOK}.edr
  427.  
  428. ${BOOKDIR}/ebt/${BOOK}.edr: ${MASTER_SGM}
  429. #if ${DTD} == "XHELP"
  430.     @(${BOOK_ENV}; ${MKHELP} -col . ${BOOK})
  431. #elif ${DTD} == "SGIDOCBK"
  432. #if exists(${MKSGIDOCBK})
  433.     @(${BOOK_ENV}; ${MKSGIDOCBK} ${MKBOOK_FLAGS} -col `pwd` ${BOOK})
  434. #else
  435.     @(${BOOK_ENV}; ${MKBOOK} ${MKBOOK_FLAGS} -col `pwd` ${BOOK})
  436. #endif
  437. #elif ${DTD} == "SGIDOC"
  438. #if exists(${MKSGIDOC})
  439.     @(${BOOK_ENV}; ${MKSGIDOC} ${MKBOOK_FLAGS} -col `pwd` ${BOOK})
  440. #else
  441.     @(${BOOK_ENV}; ${MKBOOK} ${MKBOOK_FLAGS} -col `pwd` ${BOOK})
  442. #endif
  443. #else
  444.     @(${BOOK_ENV}; ${MKBOOK} ${MKBOOK_FLAGS} -col `pwd` ${BOOK})
  445. #endif
  446.     -@for f in `${LS} -1 ${BOOKDIR}/ebt/*.tdr`; do \
  447.         (${BOOK_ENV}; ${TDRCHK} 42 $$f); done
  448.  
  449.  
  450. booklist.txt: Makefile
  451. #if ${DTD} != "OTHER"
  452.     @if [ -f booklist.txt ] ; then \
  453.         ${MV} booklist.txt booklist.txt.old; \
  454.     fi
  455.     @echo '<BOOK NAME="${TITLE}" ALIAS="'${FULL_TITLE}'" TYPE="Adi3xDocument" SGITYPE="${BOOK_ICON}" SGIHIDE="${HIDDEN}" SGIVERSION="${VERSION}" SGIBKADDR="${FEEDBACK_ADDR}" \c' > booklist.txt
  456.     @if [ ${SORT_ORDER} != "" ] ; then \
  457.         echo 'SGISORT="${SORT_ORDER}" \c' >> booklist.txt; \
  458.     fi
  459.     @if [ ${SGICONTAINER} != "" ] ; then \
  460.         echo 'SGICONTAINER=${SGICONTAINER} \c' >> booklist.txt; \
  461.     fi
  462.     @if [ ${DTD} = "SGIDOCBK" ] ; then \
  463.         echo 'SGIFRONTTAG="BOOKINFO" SGIINDEXTAG="INDEX" SGICHAPTERTAG="CHAPTER,PREFACE,PART,GLOSSARY,APPENDIX" SGIGLOSSENTTAG="GLOSSTERM" \c' >> booklist.txt; \
  464.     fi
  465.     @echo 'SGISRCHRES="${HIDDEN}" SGISRCHTAGS="$(SRCH_TAGS)" SGIGROUP="${DTD}">' >> booklist.txt
  466. #endif
  467.  
  468. prep_book: ${BOOKDIR}/${BOOK}.sgm booklist.txt
  469.     -@mkdir -p ${BOOKDIR}/ebt 1> /dev/null 2>&1
  470.     -@mkdir -p ${BOOKDIR}/index 1> /dev/null 2>&1
  471.     @if [ ! -f ${BOOKDIR}/${BOOK}.dtd ] ; then \
  472.         if [ -f ${BOOK}.dtd ] ; then \
  473.         ln -s ../../${BOOK}.dtd ${BOOKDIR}/${BOOK}.dtd; \
  474.         else \
  475.         ln -s ${REAL_DTD} ${BOOKDIR}/${BOOK}.dtd; \
  476.         fi \
  477.     fi
  478. #if make(review)
  479.     @if [ ! -d  ${BOOKDIR}/styles ] ; then \
  480.         if [ -d styles ] ; then \
  481.         ln -s ../../styles ${BOOKDIR}/styles; \
  482.         else \
  483.         ln -s ${STYLES_DIR}_review ${BOOKDIR}/styles; \
  484.         fi \
  485.     fi
  486. #else
  487.     @if [ ! -d  ${BOOKDIR}/styles ] ; then \
  488.         if [ -d styles ] ; then \
  489.         ln -s ../../styles ${BOOKDIR}/styles; \
  490.         elif [ -d ${STYLES_DIR}_${BOOK_LANG} ] ; then \
  491.         ln -s ${STYLES_DIR}_${BOOK_LANG} ${BOOKDIR}/styles; \
  492.         else \
  493.         ln -s ${STYLES_DIR} ${BOOKDIR}/styles; \
  494.         fi \
  495.     fi
  496. #endif
  497.     @if [ ! -d  ${BOOKDIR}/entities ] ; then \
  498.         if [ -d entities ] ; then \
  499.         ln -s ../../entities ${BOOKDIR}/entities; \
  500.         else \
  501.         ln -s ${ENTITIES_DIR} ${BOOKDIR}/entities; \
  502.         fi \
  503.     fi
  504.     @if [ ! -f ${BOOKDIR}/${BOOK}.ctl ] ; then \
  505.         if [ -f ${BOOK}.ctl ] ; then \
  506.         ln -s ../../${BOOK}.ctl ${BOOKDIR}/${BOOK}.ctl; \
  507.         elif [ ${DTD} = "SGIDOCBK" ] ; then \
  508.         ln -s ${BOOK_CTL} ${BOOKDIR}/${BOOK}.ctl; \
  509.         fi \
  510.     fi
  511.  
  512.  
  513. #
  514. # When creating html files from the Inso book, specify two parms - the
  515. # ouput dir in which the html files will be create (-o) and the html
  516. # file specification (-f) using the shortnam for the book
  517. #
  518.  
  519. #if ${DTD} != "HTML"
  520. html: book
  521.     @${HTML_PACKAGE} -o `pwd` -f "${BOOK}-%d.html" ${TITLE}
  522.     @${CREATE_DDF_FILE} ${TITLE}
  523. #else
  524. html:
  525.     @echo "Can't make HTML for an HTML book!"
  526. #endif
  527.  
  528. ddf_file omf_file: book
  529.     @${CREATE_DDF_FILE} ${TITLE}
  530.  
  531. book.ver ${BOOK}.ver: ${MASTER_SGM}
  532.     @${RM} -f ${BOOK}.ver
  533.     @echo "SGML Validation not supported"; exit 1
  534.  
  535. verify: ${MASTER_SGM}
  536.     -@(EBTRC=${EBTRC}; TOOLROOT=${ITOOLROOT}; export EBTRC TOOLROOT; \
  537.       if [ ! -d entities ] ; then \
  538.         if [ -d ${ENTITIES_DIR} ] ; then \
  539.         ln -s ${ENTITIES_DIR} entities; \
  540.         REMOVE_ENTS=TRUE; export REMOVE_ENTS; \
  541.         else \
  542.         REMOVE_ENTS=FALSE; export REMOVE_ENTS; \
  543.         fi \
  544.     fi; \
  545.     ${SGMLRVW} -quiet -verifyMore -dtd ${REAL_DTD} -f ${MASTER_SGM} ; \
  546.     if [ $$REMOVE_ENTS = "TRUE" ] ; then \
  547.         ${RM} -f entities ; \
  548.     fi)
  549.  
  550. book.err ${BOOK}.err: ${ERR_FILES}
  551.     @${RM} -f ${BOOK}.err
  552.     @for i in ${ERR_FILES}; do \
  553.       echo "=== $$i Translation Error/Warning report ===" >> ${BOOK}.err; \
  554.       cat $$i >> ${BOOK}.err; \
  555.       echo "" >> ${BOOK}.err; \
  556.     done
  557.  
  558. strings: 
  559. #if exists(${UPDATE_STRINGS})
  560.     ${UPDATE_STRINGS} book.sgm
  561. #else
  562.     @echo "WARNING: Could not find ${UPDATE_STRINGS}"
  563.     @echo "therefore dynamic strings have not been updated."
  564. #endif
  565.  
  566. update_frontmatter:
  567. #if exists(${FRONT_DIR})
  568.     @if [ ! -d frontmatter ] ; then \
  569.       mkdir frontmatter; \
  570.     fi
  571.     cp ${FRONT_DIR}/*.sgml frontmatter
  572. #else
  573.     @echo "WARNING: The directory ${FRONT_DIR}"
  574.     @echo "is not accessable therefore we can not update the frontmatter."
  575. #endif
  576.  
  577. book.full ${BOOK}.full:  ${ERR_FILES} ${MASTER_SGM} book
  578.     @echo " ======== Building master report file ======== "
  579.     @${RM} -f ${BOOK}.full
  580.     @for i in ${SGM_FILES}; do \
  581.       base=`basename $$i .sgm`; \
  582.       if [ -f $$base.err ] ; then \
  583.           echo "=== $$base.err Translation Error/Warning report ===" >> ${BOOK}.full; \
  584.           cat $$base.err >> ${BOOK}.full; \
  585.       fi; \
  586.       echo "" >> ${BOOK}.full; \
  587.     done
  588. #if exists(/usr/sbin/perl)
  589. #if defined(SGI_QA)
  590.     @echo "=== ${BOOK} Internal SGI Doc report ===" >> ${BOOK}.full
  591.     -@${SGIBOOK_QA} >> ${BOOK}.full
  592. #endif
  593.     @echo "=== ${BOOK} Link QA report file ===" >> ${BOOK}.full
  594.     -@(TOOLROOT=${ITOOLROOT}; export TOOLROOT; \
  595.       ${XREF} ${MASTER_SGM} >> ${BOOK}.full)
  596.     @echo "" >> ${BOOK}.full
  597.     @echo "=== ${BOOK} Glossary QA report file ===" >> ${BOOK}.full
  598. #if ! defined(GLOBAL_GLOSS) && exists(${GLOSS})
  599.     -@${GLOSSQA} -g ${GLOSS} ${MASTER_SGM} >> ${BOOK}.full
  600. #else
  601.     -@${GLOSSQA} ${MASTER_SGM} >> ${BOOK}.full
  602. #endif
  603.     @echo "" >> ${BOOK}.full
  604. #else
  605.     @echo "WARNING: Link QA and Glossary QA reports require /usr/sbin/perl...skipped" >> ${BOOK}.full
  606.     @echo "" >> ${BOOK}.full
  607. #endif
  608. #if defined(VALIDATE)
  609.     @echo "=== ${BOOK} EBT validation report file ===" >> ${BOOK}.full
  610.     -@(EBTRC=${EBTRC}; TOOLROOT=${ITOOLROOT}; export EBTRC TOOLROOT; \
  611.        if [ ! -d entities ] ; then \
  612.         if [ -d ${ENTITIES_DIR} ] ; then \
  613.         ln -s ${ENTITIES_DIR} entities; \
  614.         REMOVE_ENTS=TRUE; \
  615.         else \
  616.         REMOVE_ENTS=FALSE; export REMOVE_ENTS; \
  617.         fi \
  618.     fi ; \
  619.     ${SGMLRVW} -quiet -verifyMore -dtd ${REAL_DTD} -f ${MASTER_SGM} >> ${BOOK}.full 2>&1 ; \
  620.     if [ $$REMOVE_ENTS = "TRUE" ] ; then \
  621.         ${RM} -f entities; \
  622.     fi)
  623.     @echo "" >> ${BOOK}.full
  624. #endif
  625.  
  626.  
  627. .ORDER: _online copy_figures
  628. figures: _online copy_figures
  629.  
  630. localfigrules: Makefile
  631.     @smake -J 1 -r -f Makefile XXX=$$$$ rules
  632.  
  633. _online: localfigrules
  634.     @if [ -d orig ] ; then \
  635.       (mkdir -p online 1> /dev/null 2>&1; \
  636.       TOOLROOT=${ITOOLROOT}; export TOOLROOT; \
  637.       make -r -f Makefile COMMONPREPRULES=${COMMONFIGRULES} online_figs) ;\
  638.     fi
  639.  
  640. copy_figures: ${SGM_FILES} ${MASTER_SGM}
  641.     -@mkdir -p ${BOOKDIR}/figures 1> /dev/null 2>&1
  642.     -@if [ -d online ] ; then \
  643.       (for i in ${BOOKDIR}/figures/*; do \
  644.         ${RM} -f $$i ; done ) ; \
  645.     fi
  646. #if defined(MISC_FILES)
  647. #if ! empty(MISC_FILES)
  648.     @(cd orig; ${CP} ${MISC_FILES} ../${BOOKDIR}/figures ; cd ..)
  649. #endif
  650. #endif
  651. #if ${DTD} == "SGIDOC" || ${DTD} == "SGIDOCBK"
  652.     @if [ -d online ] ; then \
  653.       ${CLEAN_CGMS} ${MASTER_SGM} online ; \
  654.       (for i in `${COPY_SGIDOC_FIGS} ${MASTER_SGM}` ; do \
  655.           ${CP} online/$$i ${BOOKDIR}/figures/$$i ; \
  656.       done) ; \
  657.     fi
  658. #else
  659.     @if [ -d online ] ; then \
  660.     (cd online; for i in *; do \
  661.         ${CP} $$i ../${BOOKDIR}/figures/$$i ; \
  662.     done; cd ..) ; \
  663.     fi
  664.  
  665. #endif
  666.     -@rmdir ${BOOKDIR}/figures 1> /dev/null 2>&1
  667.  
  668. _print print: localfigrules
  669.     -@mkdir -p print 1> /dev/null 2>&1
  670.     @make -r -f Makefile COMMONPREPRULES=${COMMONFIGRULES} print_figs
  671.  
  672. #if ${DTD} != "HTML"
  673. #if ! defined(RAWIDB)
  674. install::
  675.       @echo "warning: 'install' not supported if RAWIDB not defined"
  676. #else
  677. .ORDER: mk_book copy_figures common_install
  678. install:: mk_book copy_figures common_install
  679. #endif
  680. #endif
  681.  
  682. #if ! defined(RAWIDB)
  683. booksinstall::
  684.       @echo "warning: 'install' not supported if RAWIDB not defined"
  685. #else
  686. .ORDER: mk_book figures copy_figures common_install
  687. booksinstall:: mk_book figures copy_figures common_install
  688. #endif
  689.  
  690. common_install:
  691.     $(INSTALL) -u root -g sys  -m 755 \
  692.         -idb '${BOOKSUBSYSTEM} removeop("if [ -r $$rbase/usr/sbin/insightAdmin ]; then chroot \$$rbase /usr/sbin/insightAdmin -avfn ${BOOK_LANG} ${BOOKSHELF}>>\$$rbase/var/share/Insight/install.insight.log 2>&1; fi")' \
  693.         -dir ${BOOKSHELF}/${BOOKDIR}
  694.     $(INSTALL) -u root -g sys  -m 755 -idb ${BOOKSUBSYSTEM} \
  695.         -dir ${BOOKSHELF}/${BOOKDIR}/ebt
  696.     $(INSTALL) -m 644 -f ${BOOKSHELF} -idb \
  697.         ${BOOKSUBSYSTEM} ${BOOKDIR}/ebt/*
  698.     $(INSTALL) -u root -g sys  -m 755 -idb ${BOOKSUBSYSTEM} \
  699.         -dir ${BOOKSHELF}/${BOOKDIR}/index
  700.     $(INSTALL) -m 644 -f ${BOOKSHELF} -idb \
  701.         ${BOOKSUBSYSTEM} ${BOOKDIR}/index/*
  702.     $(INSTALL) -u root -g sys  -m 755 -idb ${BOOKSUBSYSTEM} \
  703.         -dir ${BOOKSHELF}/${BOOKDIR}/styles
  704.     $(INSTALL) -m 644 -f ${BOOKSHELF} -idb \
  705.         ${BOOKSUBSYSTEM} ${BOOKDIR}/styles/*
  706.     if [ -d online ] ; then \
  707.         $(INSTALL) -u root -g sys  -m 755 -idb ${BOOKSUBSYSTEM} \
  708.             -dir ${BOOKSHELF}/${BOOKDIR}/figures ; \
  709.         (for i in ${BOOKDIR}/figures/*; do \
  710.             $(INSTALL) -m 644 -f ${BOOKSHELF} -idb \
  711.             ${BOOKSUBSYSTEM} $$i ; done ) \
  712.     ; fi
  713.     if [ -d help ] ; then \
  714.         if [ "${BOOK_LANG}" = "C" ] ; then \
  715.              $(INSTALL) -m 644 -f ${HELPDIR} -idb ${HELPSUBSYSTEM}  \
  716.             `${COPY_HELPMAPS} ${MASTER_SGM} help` ; \
  717.         else \
  718.               (cd help; \
  719.             $(INSTALL) -m 644 -f ${HELPDIR}/help/${BOOK_LANG}\
  720.             -idb ${HELPSUBSYSTEM} \
  721.             `${COPY_HELPMAPS} ../${MASTER_SGM} .` ; \
  722.                cd ..) ; \
  723.         fi \
  724.     ; fi
  725.     $(INSTALL) -m 644 -f ${BOOKSHELF}/${BOOKDIR} \
  726.         -idb '${BOOKSUBSYSTEM} exitop("(chroot \$$rbase /usr/sbin/insightAdmin -avfn ${BOOK_LANG} ${BOOKSHELF}>>\$$rbase/var/share/Insight/install.insight.log)2>>\$$rbase/var/share/Insight/install.insight.log")' \
  727.         booklist.txt
  728. ### #if exists($(ROOT)/usr/include/make/commonindexdefs) 
  729. ### #    Generate wrd and html index files for SGML book
  730. ###     @echo "\tbuilding word list..."
  731. ###     (EBTRC=${EBTRC}; EBT_PLATFORM=${EBT_PLATFORM}; TOOLROOT=${ITOOLROOT}; \
  732. ###         LD_LIBRARY_PATH=${TOOLROOT}/usr/share/ebt/irix5m/lib:${LD_LIBRARY_PATH}; \
  733. ###          export EBTRC EBT_PLATFORM TOOLROOT LD_LIBRARY_PATH; \
  734. ###         ${DTL2SGFT} -b ${BOOK} -s `pwd` -u ${SHELF} -q ${INDEX_GRAN} \
  735. ###         -d ${TOOLROOT}/usr/share/ebt/data)
  736. ###     if test ! -d $(WORDDIR); then \
  737. ###         mkdir -p $(WORDDIR) \
  738. ###     ; fi
  739. ###     -mv ${BOOKDIR}/*.wrd $(WORDDIR)
  740. ###     $(INSTALL) -m 644 -f ${BOOKSHELF} -idb ${BOOKSUBSYSTEM} ${BOOKDIR}/*.html 
  741. ### #endif
  742.  
  743.  
  744. #if ${DTD} != "HTML"
  745. #if exists($(ROOT)/usr/include/make/commonindexdefs) 
  746. clean:: clean_book clean_reports clean_backups sg_index_clean
  747. #else
  748. clean:: clean_book clean_reports clean_backups
  749. #endif
  750.     ${RM} -rf $(DIRT) ${LOCALFIGRULES}
  751.  
  752. clobber:: clean clean_online clean_sgm clean_print clean_htmlbook
  753. #endif
  754.  
  755. # Remove the master sgml file and files in the 'books' sub directory.
  756. # Also now remove tmp_gen with generated html files
  757. clean_book::
  758.     ${RM} -f ${MASTER_SGM} ${INDEXFILE} ${MIF_FILES}
  759.     ${RM} -rf ${BOOKDIR}/ebt ${BOOKDIR}/index ${BOOKDIR}/styles
  760.     ${RM} -rf ${BOOKDIR}/entities ${BOOKDIR}/figures
  761.     ${RM} -f ${BOOKDIR}/${BOOK}.dtd ${BOOKDIR}/${BOOK}.sgm ${BOOKDIR}/${BOOK}.ctl
  762.     ${RM} -rf tmp_gen
  763.  
  764. # Remove the report files
  765. #if ${BOOK_FILES} == "book.sgm"
  766. clean_reports::
  767.     ${RM} -f ${BOOK}.full
  768. #else
  769. clean_reports::
  770.     ${RM} -f ${VER_FILES} ${ERR_FILES}
  771.     ${RM} -f ${BOOK}.err ${BOOK}.ver ${BOOK}.full
  772. #endif
  773.  
  774.  
  775. # Remove the generated figures
  776. clean_online::
  777.     ${RM} -f online/*
  778.  
  779. #if defined(BOOK_FILES)
  780. # Remove all sgml files - only if NONE of the sources are .sgm files
  781. #if ${BOOK_FILES:S/[     ]*/ /g} == "${BOOK_FILES:S/.sgm$/.skip/g}"
  782. clean_sgm::
  783.     ${RM} -f ${SGM_FILES}
  784. #else
  785. clean_sgm::
  786.  
  787. #endif
  788. #endif
  789.  
  790. # Remove Frame backup files
  791. #if ${BOOK_FILES} == "book.sgm"
  792. clean_backups::
  793. #else
  794. clean_backups::
  795.     ${RM} -f ${BACKUP_FILES}
  796. #endif
  797.  
  798. clean_print::
  799.     ${RM} -f print/*
  800.  
  801. # Remove html.tar book and ddf (omf) file(s) (checked-in files)
  802. clean_htmlbook::
  803.     ${RM} -rf html.tar *.ddf *.omf
  804.  
  805. #if exists($(ROOT)/usr/include/make/commonindexdefs) 
  806. $(INDEXPREF)sg_index_clean:: 
  807.     -@/usr/bin/rm -f $(IDIRT)
  808. #if defined(SRC)
  809.     -@/usr/bin/rm -f $(WORDDIR)/$(IDIRT)
  810. #endif
  811. #endif
  812.  
  813.  
  814. # Remove any crufty files
  815. XDIRT = printFiles.* onlineFiles.* localFigs.* ${DIRT_FILES} ${BOOK}.sgml.tmp \
  816.     *.bak *.backup booklist.txt.old EndPart.err EndPart
  817.  
  818.